from paddleocr import PaddleOCR, draw_ocr

class text_positioning:
    
    # OCR识别
    def get_text_positioning(self,img_path):
        # Paddleocr目前支持的多语言语种可以通过修改lang参数进行切换
        # 例如`ch`, `en`, `fr`, `german`, `korean`, `japan`
        ocr = PaddleOCR(use_angle_cls=True, lang="ch")  # need to run only once to download and load model into memory
        result = ocr.ocr(img_path, cls=True)
        # 创建字典变量 result
        backdata = []
        for idx in range(len(result)):
            res = result[idx]
            for line in res:
                # 将line追加到result
                backdata.append(line)
        return backdata
        
        
        
